package net.sf.midollo.net.protocol.multitunnel.client;

import java.io.IOException;

import net.sf.midollo.io.IOStream;
import net.sf.midollo.net.protocol.Protocol;
import net.sf.midollo.net.protocol.multitunnel.MultiTunnelSession;

public class MultiTunnelClient extends MultiTunnelSession implements Protocol {

  protected final MultiTunnelClientFactory factory;

  public MultiTunnelClient(MultiTunnelClientFactory factory, int sessionId, IOStream ioStream, int bufSize) throws IOException {
    super(factory, sessionId, ioStream, bufSize);
    this.factory = factory;
  }

  public void destroySession() throws IOException {
    super.destroySession();
    disconnect();
  }

  public void disconnect() throws IOException {
    this.factory.disconnect(this);
  }
}
